﻿using System;
using NETDeob.Core.Deobfuscators.Confuser;
using NETDeob.Deobfuscators.CodeFort;
using NETDeob.Deobfuscators.CodeWall;
using NETDeob.Deobfuscators.Confuser;
using NETDeob.Deobfuscators.Manco;
using NETDeob.Deobfuscators.Obfusasm;
using NETDeob.Deobfuscators.Phoenix_Protector;
using NETDeob.Deobfuscators.Rummage;
using NETDeob.Deobfuscators.Unidentified;
using NETDeob.Engine.Utils;
using NETDeob.Misc.Structs__Enums___Interfaces.Signatures;
using NETDeob.Unpackers.ExePack;
using NETDeob.Unpackers.Mpress;
using NETDeob.Unpackers.NetShrink;
using NETDeob.Unpackers.Netz;
using NETDeob.Unpackers.Sixxpack;

namespace NETDeob.Engine
{
    public static class Signatures
    {
        public struct UnidentifiedSignature : IUnidentifiedSignature
        {
            public string Name
            {
                get { return "Unidentified"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(UnknownDeobfuscator); }
            }
        }

        public struct ConfuserSignature : IObfuscatorSignature
        {
            public enum InternalVer
            {
                V1_7,
                V1_8,
                V1_9,
                Unknown
            }

            public InternalVer InternalVersion;
            private string _ver;

            public ConfuserSignature(string ver, InternalVer internalVer)
            {
                _ver = ver;
                InternalVersion = internalVer;
            }

            public string Name
            {
                get { return "Confuser " + _ver; }
            }

            public Type DeObfuscator
            {
                get { return typeof(ConfuserDeobfuscator); }
            }

            public static InternalVer GetInternalVersion(string ver)
            {
                switch(ver)
                {
                    case "Confuser v1.7.0.0":
                        return InternalVer.V1_7;

                    case "Confuser v1.8.0.0":
                        return InternalVer.V1_8;

                    case "Confuser v1.9.0.0":
                        return InternalVer.V1_8;

                    default:
                        return InternalVer.Unknown;
                }
            }
        }
        public struct UConfuserSignature : IUnsupportedSignature
        {
            private string _ver;

            public UConfuserSignature(string ver)
            {
                _ver = ver;
            }

            public string Name
            {
                get { return "Confuser " + _ver; }
            }

            public Type DeObfuscator
            {
                get { throw new NotImplementedException(); }
            }
        }

        public struct PhoenixSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "Phoenix Protector"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(PhoenixProtectorDeobfuscator); }
            }
        }
        public struct CodeWallSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "CodeWall"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(CodeWallDeobfuscator); }
            }
        }
        public struct MancoSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "Manco.NET Obfuscator"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(MancoDeobfuscator); }
            }
        }
        public struct NetzSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "NetZ .NET Packer"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(NetzUnpacker); }
            }
        }
        public struct CodeFortSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "CodeFort Obfuscator"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(CodeFortDeobfuscator); }
            }
        }
        public struct RummageSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "Rummage Obfuscator"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(RummageDeobfuscator); }
            }
        }
        public struct ObfusasmSignature : IObfuscatorSignature
        {
            public string Name
            {
                get { return "Obfusasm Obfuscator"; }
            }

            public Type DeObfuscator
            {
                get { return typeof (ObfusasmDeobfuscator); }
            }
        }

        public struct NetShrinkSignature : IPackerSignature
        {
            public string Name
            {
                get { return ".NET Shrink"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(NetShrinkUnpacker); }
            }
        }
        public struct MpressSignature : IPackerSignature
        {
            public string Name
            {
                get { return "Mpress .NET Packer"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(MpressUnpacker); }
            }
        }
        public struct RpxSignature : IPackerSignature
        {
            public string Name
            {
                get { return "Rpx .NET Packer"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(NetzUnpacker); }
            }
        }
        public struct ExePackSignature : IPackerSignature
        {
            public string Name
            {
                get { return "ExePack.NET Packer"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(ExePackUnpacker); }
            }
        }
        public struct SixxpackSignature : IPackerSignature
        {
            public string Name
            {
                get { return "Sixxpack .NET Packer"; }
            }

            public Type DeObfuscator
            {
                get { return typeof(SixxpackUnpacker); }
            }
        }
    }
}
